﻿@model QuanLyGiaoVuUI.Models.CaiDat.QuanLyTemplateViewModel
@{
    ViewBag.Title = "QuanLyTemplate";
    Layout = "~/Views/Shared/_blueWhaleLayout.cshtml";
}

@{Html.RenderPartial("CaiDatMenuPartial");}

<div id="main" class="grid_10">
    <!--  start page-heading -->

    <div id="page-heading" class="box round first grid">
        <h2>Danh sách các nhóm từ khóa</h2>
    <!-- end page-heading -->

    <div class="block">
            @using (Ajax.BeginForm("QuanLyTemplate","CaiDat", new AjaxOptions{
                HttpMethod = "POST",
                OnSuccess = "SuccessCallback"
            }))
        {
                <input type="submit" value="Lưu thay đổi" />
            <table class="data display datatable">
                <tr>
                    <th class="sorting table-header-repeat line-left minwidth-1" style="text-align: left"><a href="">Tên mẫu</a></th>
                    <th class="sorting table-header-repeat line-left minwidth-1" style="text-align: left"><a href="">File mẫu</a></th>
                    <th class="sorting table-header-repeat line-left"><a href="">Xem từ khóa</a></th>
                </tr>
                    <tr class="gradeA odd">
                        <td>Mẫu file Danh sách lớp đăng ký học phần</td>
                        <td>@Html.DropDownListFor(m => m.MaTaiLieuDangKyHocPhan, new SelectList(Model.DanhSachTaiLieu, "MaTaiLieu", "TenTaiLieu"))</td>
                        <td><a href="javascript:;" class="btnDetail" id="@QuanLyGiaoVuService.Utilities.ThamSoConstantUtility.DKHPTEMPLATE">Chi tiết</a></td>
                    </tr>
                    <tr class="gradeA even">
                        <td>Mẫu file Lịch thi học phần</td>
                        <td>@Html.DropDownListFor(m => m.MaTaiLieuDanhSachLichThi, new SelectList(Model.DanhSachTaiLieu, "MaTaiLieu", "TenTaiLieu"))</td>
                        <td><a href="javascript:;" class="btnDetail" id="@QuanLyGiaoVuService.Utilities.ThamSoConstantUtility.LICHTHITEMPLATE">Chi tiết</a></td>
                    </tr>
                    <tr class="gradeA even">
                        <td>Mẫu file Danh sách sinh viên </td>
                        <td>@Html.DropDownListFor(m => m.MaTaiLieuDanhSachSinhVien, new SelectList(Model.DanhSachTaiLieu, "MaTaiLieu", "TenTaiLieu"))</td>
                        <td><a href="javascript:;" class="btnDetail" id="@QuanLyGiaoVuService.Utilities.ThamSoConstantUtility.SINHVIENTEMPLATE">Chi tiết</a></td>
                    </tr>
            </table>
        }
            <!--  end product-table................................... -->
    </div>
</div>
</div>

<div class="clear">&nbsp;</div>

<div id="templateDetailDialog"></div>

<script>
    $(document).ready(function () {
        $(".btnDetail").bind("click", function () {
            var id = $(this).attr("id");
            var dialogTitle = $(this).parent().prev().html();
            $("#templateDetailDialog").load("/CaiDat/ChiTietTemplate?tenTemplate=" + id);
            $("#templateDetailDialog").dialog({
                autoOpen: true,
                title: dialogTitle,
                width: 300,
                modal: true});
        });
    });

    function SuccessCallback(data) {
        if (data.success) {
            ToastManager.showSuccessToast("Cập nhật thành công.");
        }
        else
            ToastManager.showStickyWaringToast(data.message);
    }
</script>

